/**
 * Copyright (C) 2018 - 2020 https://github.com/LeeYan9
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.model.ro;

import com.bifrost.entity.PlanType;
import com.bifrost.validator.group.IsAdd;
import com.bifrost.validator.group.IsUpdate;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.Valid;
import javax.validation.constraints.Future;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Lee
 * Create Class on 2018/8/13
 * @com.bifrost.model.ro
 * @wechat-mall
 */
@Data
@ApiModel("商品添模型")
public class PlanModel implements Serializable{

    @Null(message = "id必须为空", groups = {IsAdd.class})
    @NotNull(message = "id不能为空", groups = {IsUpdate.class})
    private Long planId;
    @NotNull(message = "活动起始日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date activeStartTime;
    @NotNull(message = "活动终止日期不能为空")
    @Future(message = "活动终止日期必须在当前日期之后")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date activeEndTime;
    private String description;
    @NotBlank(message = "活动标题不为空")
    private String title;
    @NotBlank(message = "活动图片不为空")
    private String url;
    private PlanType planType = com.bifrost.entity.PlanType.TRYOUT;
    @Valid
    private List<PlanItemModel> planItemModels;

}
